package test.formModel;

import java.awt.Color;
import java.lang.reflect.Field;

import org.destiny.swing.annotation.ArrayElement;
import org.destiny.swing.annotation.IArrayProducer;

public class MyArrayProducer implements IArrayProducer {

	@Override
	public ArrayElement[] getArray(Field field, Object object) {
		Class<?> fieldType = field.getType();
		if (fieldType.isArray() && fieldType.getComponentType().equals(Color.class)) {
			return new ArrayElement[] { new ArrayElement(Color.red, "红色"), new ArrayElement(Color.green, "绿色"),
					new ArrayElement(Color.blue, "蓝色"), new ArrayElement(Color.white, "白色") };
		} else
			return null;
	}

}
